﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RedDragon.Common.Domain.Process;
using RedDragon.Common.Infrastructure.Interface;
using RedDragon.RBAC.API.Application.Common.ProcessW;
using RedDragon.RBAC.API.Application.Common.WarehouseW;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Controllers
{
    /// <summary>
    /// 工序控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class ProcessController : ControllerBase
    {
        public readonly IMediator mediator;

        public ProcessController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 工序新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("ProcessAdd")]
        public async Task<Result> Handle(ProcessCreateCommon request)
        {
           return await mediator.Send(request);
        }

        /// <summary>
        /// 工作中心列表展示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("WorkCenterList")]
        public async Task<Result> Handle(WorkCentersSerchCommon request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 资源数据展示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("ResourcesList")]
        public async Task<Result> Handle([FromQuery]resourcesSearchCommon request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序明细新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpPost("ProcessDetailAdd")]
        public async Task<Result> Handle(ProcessDetailCreateCommon request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序明细列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpGet("ProcessDetailList")]
        public async Task<Result> Handle([FromQuery]ProcessDetailSearchCommon request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpGet("ProcessList")]

        public async Task<Result> Handle([FromQuery]ProcessSearchCommon request)
        {
            return await mediator.Send(request);
        }
    }
}
